﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BrnMall.Core;
using BrnMall.Manager.Domain.Restaurant;

namespace QIDong.WeApp.Models
{
    /// <summary>
    /// 排队项
    /// </summary>
    public class LineItemModel
    {
        /// <summary>
        /// 数据标号
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int StoreId { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 前缀
        /// </summary>
        public string StartCode { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int DisplayOrder { get; set; }
        /// <summary>
        /// 下个取号号码
        /// </summary>
        public int NextNumber { get; set; }
        /// <summary>
        /// 当前叫号
        /// </summary>
        public int CurrNumber { get; set; }
       /// <summary>
       /// 当前排队人数
       /// </summary>
        public int PendingCount { get; set; }
    }
    /// <summary>
    /// 排队序列
    /// </summary>
    public class LineQueueModel
    {
        /// <summary>
        /// 主键
        /// </summary>
        public long Id { get; set; }
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int StoreId { get; set; }
        /// <summary>
        /// 排队项
        /// </summary>
        public LineItem LineItem { get; set; }
        /// <summary>
        /// 排队人
        /// </summary>
        public PartUserInfo User { get; set; }
        /// <summary>
        /// 当前编号
        /// </summary>
        public int LineNumber { get; set; }
        /// <summary>
        /// 状态0排队中，1正叫号，3已就餐，4已过号
        /// </summary>
        public int QueueState { get; set; }
        /// <summary>
        /// 当前队列的前排正排队人数(取列表时不会计算)
        /// </summary>
        public int BeforeCount { get; set; }
        /// <summary>
        /// 取号时间
        /// </summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 音频播放地址
        /// </summary>
        public string VoiceSrc { get; set; }
        /// <summary>
        /// 等待分钟数
        /// </summary>
        public double WaitingMins =>Math.Round(TimeSpan.FromTicks(DateTime.Now.Ticks-CreateTime.Ticks).TotalMinutes);
        /// <summary>
        /// 前缀
        /// </summary>
        public string StartCode { get; set; }
        /// <summary>
        /// 构造
        /// </summary>
        public LineQueueModel()
        {
            BeforeCount = 0;
            VoiceSrc = "";
        }


    }

    /// <summary>
    /// 餐位
    /// </summary>
    public class DiningTableListModel
    {
        /// <summary>
        /// 餐位类型
        /// </summary>
        public IList<DiningTableType> TableTypes { get; set; }
        /// <summary>
        /// 餐位列表
        /// </summary>
        public IList<DiningTableViewModel> DiningTables { get; set; }
    }
    /// <summary>
    /// 餐位
    /// </summary>
    public class DiningTableViewModel
    {
        /// <summary>
        /// ID编号
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int StoreId { get; set; }
        /// <summary>
        /// 餐位类型
        /// </summary>
        public DiningTableType TableType { get; set; }
        /// <summary>
        /// 餐位号码
        /// </summary>
        public string TableNumber { get; set; }
        /// <summary>
        /// 餐位状态
        /// </summary>
        public int DiningState { get; set; }
        /// <summary>
        /// 对应的餐位二维码
        /// </summary>
        public string WeQrCode { get; set; }
    }
}